import React, { FC } from "react";
import { Typography } from "antd";
import { QuestionInfoPropsType, QuestionInfoDefaultProps } from "./interface";

const { Title, Paragraph } = Typography;
const Component: FC<QuestionInfoPropsType> = (props: QuestionInfoPropsType) => {
  const { title = "", desc = "" } = { ...QuestionInfoDefaultProps, ...props };
  //回车换行处理
  const descText = desc.split("\n");
  return (
    <div style={{textAlign:'center'}}>
      <Title style={{ fontSize: "24px" }}>{title}</Title>
      <Paragraph>
        {descText.map((t, index) => (
          <span key={index}>{index > 0 && <br />}{t}</span>
        ))}
      </Paragraph>
    </div>
  );
};
export default Component;
